package com.feign;

import feign.Logger;
import feign.Request;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by qhe on 2018/8/21.
 */

@Configuration
public class FeignConfiguration {
    /**
     * 日志配置
     * @return
     */
    @Bean
    Logger.Level feignLoggerLevel(){
        return Logger.Level.FULL;
    }

    /**
     * 超时配置
     * @return
     */
    @Bean
    public Request.Options options(){
        return new Request.Options(5000,10000);
    }

    /**
     * basic认证配置，用于拦截权限认证
     * @return
     */
//    @Bean
//    public BasicAuthorizationInterceptor basicAuthorizationInterceptor(){
//        return new BasicAuthorizationInterceptor("user","password");
//    }
    //指定某一个服务关闭容错保护机制
//    @Bean
//    @Scope("prototype")
//    public Feign.Builder feignBuilder(){
//        return Feign.builder();
//    }
}
